<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>for/of</title>
</head>

<body>
  <script>
    let string = {}
    for (let letter of "mississippi") {
      // console.log(letter);
      if (string[letter]) {
        console.log(letter);
        console.log(string[letter]);
        string[letter]++
      } else {
        console.log(string[letter]);
        console.log(letter);
        string[letter] = 1
      }
    }
    console.log(string);

    // Set集合
    let text = "Na na na na na na Batman"
    let wordSet = new Set(text.split(" "))
    console.log(wordSet);

    // Map映射
    let a = {
      name: 'wcy',
      age: 24
    }

    let wordmap = new Map([['name', a.name]])
    for (let [key, value] of wordmap) {
      console.log(key);
      console.log(value);
    }
    console.log(wordmap);


    let data = { x: 1, y: 2, z: 3 }
    let key = []
    let i = 0
    for (let k of Object.keys(data)) {
      console.log(k);
      key[i++] = k
    }
    console.log(key);
  </script>
</body>

</html>